<%@page import="java.util.Date"%>
<%@page contentType="text/html" pageEncoding="UTF-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt" %>

<h1>Search for WSDL documents</h1>

<form method="post" action="${pageContext.request.contextPath}/wsdl/browse/">
    <table>
        <tr>
            <td>
                FileName
            </td>
            <td><input type="text" name="searchValue" /></td>
        </tr>
    </table>

    <input type="submit" class="btn" value="Search" />
</form>

<h1>List of WSDL documents</h1>
<div class="list-group">
    <c:choose>
        <c:when test="${f:length(wsdls) gt 0}">
            <c:forEach var="item" items="${wsdls}">
                <jsp:useBean id="itemDate" class="java.util.Date" />
                <jsp:setProperty name="itemDate" property="time" value="${item.timeStamp}" />
                <a class="list-group-item width-80 flow-left" href="${pageContext.request.contextPath}/wsdl/browse/${item.fileName}/${item.timeStamp}">${item.fileName} (<fmt:formatDate pattern="dd. MM. yyyy hh:mm:ss" value="${itemDate}" dateStyle="long" timeZone="GMT+2"/>)</a>
                <a class="flow-right" href="${pageContext.request.contextPath}/wsdl/delete/${item.fileName}/${item.timeStamp}" onclick="return confirm('Do you really want to delete all versions of this document?')">DELETE ALL VERSIONS</a>
            </c:forEach>
        </c:when>
        <c:otherwise>
            No wsdl documents.
        </c:otherwise>
    </c:choose>
</div>
